<template>
  <div>
    <!-- 面包屑导航 -->
    <elBread></elBread>
    <!-- 添加按钮 -->
    <el-button type="primary" style="margin-top: 10px" @click="addDiolog">添加</el-button>
    <!-- 表格 -->
    <v-list @edit="edit" />
    <!-- 弹框 -->
    <v-dialog :isShow="isShow" :isAdd="isAdd" @cancel="cancel" ref="diaRef" />
  </div>
</template>

<script lang="ts" setup>
import vList from "./list.vue";
import vDialog from "./dialog.vue";
import { ref } from "vue";

// 用于弹框的显示隐藏
let isShow = ref(false);
// 用于弹框编辑的显示隐藏
let isAdd = ref(true);
// 添加
let addDiolog = () => {
  isShow.value = true;
  isAdd.value = true;
};
// 取消
let cancel = (e: Boolean) => {
  isShow.value = e;
};
const diaRef = ref<any>(null)
// 编辑
let edit = (id: any) => {
  isShow.value = true,
  // 告诉弹框你是一个编辑
  isAdd.value = false;
  diaRef.value.lookup(id)
};
</script>

<style lang="less" scoped></style>
